import request from '../../utils/request';

// 会员收货地址管理相关 API

// 更新收货地址
export const updateMemberAddress = (data: any) => {
    return request({
        url: '/member/api/member-address',
        method: 'put',
        data
    });
};

// 创建收货地址
export const createMemberAddress = (data: any) => {
    return request({
        url: '/member/api/member-address',
        method: 'post',
        data
    });
};

// 查询地址详情
export const getMemberAddressById = (id: string) => {
    return request({
        url: `/member/api/member-address/${id}`,
        method: 'get'
    });
};

// 删除收货地址
export const deleteMemberAddress = (id: string) => {
    return request({
        url: `/member/api/member-address/${id}`,
        method: 'delete'
    });
};

// 设置默认地址
export const setDefaultAddress = (id: string) => {
    return request({
        url: `/member/api/member-address/${id}/default`,
        method: 'put'
    });
};

// 查询会员默认地址
export const getDefaultAddress = (memberId: string) => {
    return request({
        url: `/member/api/member-address/default/${memberId}`,
        method: 'get'
    });
};

// 查询会员地址列表
export const getMemberAddressList = (memberId: string) => {
    return request({
        url: `/member/api/member-address/member/${memberId}`,
        method: 'get'
    });
};
